Passed
Push — master ( f602d8...7b3414 )
by Huu-Phat
02:55 queued 11s
created

MyDocument.render   A

Complexity

Conditions 1

Size

Total Lines 37
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 33
dl 0
loc 37
c 0
b 0
f 0
rs 9.0879
cc 1
1
import React from 'react'
2
import Document, { Html, Head, Main, NextScript } from 'next/document'
3
/*
4
 * Some notes:
5
 * 1) _document.js will load on server side -> all this meta tag will be fetched by Scraper of Facebook, Linkedin, ...
6
 * 2) og:image need to be change name in order for FB to reload the new preview image
7
 * 3) sharing on staging env wont work, because og:url is set to main page
8
 */
9
class MyDocument extends Document {
10
  static async getInitialProps(ctx) {
11
    const initialProps = await Document.getInitialProps(ctx)
12
    return { ...initialProps }
13
  }
14
15
  render() {
16
    return (
17
      <Html>
18
        <Head>
19
          <link rel="icon" href="/favicon.ico" />
20
          <link rel="canonical" href="https://phatho-folio.now.sh/" />
21
          <meta property="og:title" content="DeKal | Portfolio" />
22
          <meta property="og:type" content="website" />
23
          <meta
24
            property="og:description"
25
            content="Dekal's Portfolio and Blog"
26
          />
27
          <meta
28
            property="og:image"
29
            content="https://phatho-folio.now.sh/images/cover-img.png"
30
          />
31
          <meta
32
            property="og:image:secure_url"
33
            content="https://phatho-folio.now.sh/images/cover-img.png"
34
          />
35
          <meta property="og:url" content="https://phatho-folio.now.sh/" />
36
          <meta property="og:site_name" content="DeKal Portfolio" />
37
          <meta property="og:image:alt" content="DeKal Portfolio" />
38
          <meta
39
            name="google-site-verification"
40
            content="ofwBFRuFL3aycSJjDcrhc8hWEPKuJ7LkNCLUrsB0Sj4"
41
          />
42
          <meta name="robots" content="index,follow" />
43
44
          <meta name="googlebot" content="index,follow" />
45
        </Head>
46
        <body>
47
          <Main />
48
          <NextScript />
49
        </body>
50
      </Html>
51
    )
52
  }
53
}
54
55
export default MyDocument
56